.\"                                      Hey, EMACS: -*- nroff -*-
.TH SJPEG 1 "Feb 26, 2018"
.SH NAME
sjpeg \- compress a PNG, JPEG or PPM image file to a baseline JPEG file
.SH SYNOPSIS
.B sjpeg
.RI [ options ] " input_file \-o output_file.jpg
.br
.SH DESCRIPTION
This manual page documents the
.B sjpeg
command.
.PP
\fBsjpeg\fP compresses a PNG, JPEG or PPM image or recompresses a JPEG image,
using the baseline JPEG format.
.SH OPTIONS
The basic options are:
.TP
.BI \-o " string
Specify the name of the output JPEG file.
.TP
.B \-h, \-help
A summary of all the possible options.
.TP
.B \-version
Print the version number (as major.minor.revision) and exit.
.TP
.BI \-q " float
Specify the compression factor between 0 and 100. The default
is 75.
A small factor produces a smaller file
with lower quality. Best quality is achieved by using a value of 100.
If the input source is a JPEG file, the compression factor will be limited
to never exceed the source's quality unless the -no_limit option is used.
This option is disabled by subsequent use (in parsing order) of the \-r
option.
.TP
.BI \-r " float
Specify the reduction factor for JPEG source. The default is 100 (no reduction).
A small reduction factor produces a smaller file with lower quality.
When using a value of 100, the source JPEG file is only recompressed with
closed to no quality loss (but file size will likely be smaller).
This option is disabled by subsequent use (in parsing order) of the \-q
option.
.TP
.BI \-size " int
Specify a target size to try and reach using several passes. By default, the
internal search loop will try to get as close as possible to the specified
size. This option has precedence over the \-pnsr one.
See also the \-pass option.
.TP
.BI \-psnr " float
Specify a target PSNR to try and reach using several passes. By default, the
internal search loop will try to get as close as possible to the specified
distortion. Note that the Peak-Signal-to-Noise is computed using the YUV
samples, not the RGB ones.
See also the \-pass option.
.TP
.BI \-tolerance " float
Tolerance (in percent) used during convergence to target value when \-psnr
or \-size option is used.
.TP
.BI \-qmin " int
Minimum acceptable quality factor used during the search (when \-psnr
or \-size option is used). The search will halt if the quality adjustment
would drop lower than the \fBqmin\fP value.
.TP
.BI \-qmax " int
Maximum acceptable quality factor used during the search (when \-psnr
or \-size option is used). The search will avoid using a quality factor
larger than the \fBqmax\fP value.
.TP
.BI \-pass " int
Specify the number of internal loop to use for convergence toward a target
size or distortion. If none is specified but \-size or \-psnr option is
used, then a default value of \fB10\fP is used.
.TP
.B \-yuv_mode " int
Specify the YUV color space method to use. Possible values are
.IP
0: automatic decision (default)
.IP
1: use YUV 4:2:0 downsampling
.IP
2: use 'Sharp' YUV 4:2:0 downsampling - slower but more accurate
.IP
3: use YUV 4:4:4 (full resolution for U/V chroma planes)
.TP
.B \-444
Shortcut for \-yuv_mode 3
.TP
.B \-sharp
Shortcut for \-yuv_mode 2
.TP
.B \-420
Shortcut for \-yuv_mode 1
.TP
.B \-estimate
If the source is a JPEG file, print the estimated quality and exit.
.TP
.B \-i, \-info
Print some information about the input file and exit.
.TP
.BI \-xmp " string
Specify the output XMP metadata. Warning, this will overwrite any data
available from the source. No content validation is performed.
.TP
.BI \-exif " string
Specify the output EXIF metadata. Warning, this will overwrite any data
available from the source. No content validation is performed.
.TP
.BI \-icc " string
Specify the output Color Profile metadata. Warning, this will overwrite
any data available from the source. No content validation is performed.
.TP
.B \-quiet
Disable information message (error messages are still printed).
.TP
.B \-short
Only display short information about the output result.
.TP
.B \-crc
Only display the CRC32 checksum of the output and exit.
.TP
.B \-md5
Only display the MD5 digest of the output and exit.
.TP
.B \-no_limit
Disable the quantization limit (in case of JPEG input file) allowing to
recompress the source at a higher quality factor (result is uncertain,
though!).
.TP
.B \-no_adapt
Disable adaptive quantization optimization (faster processing, larger file)
.TP
.B \-trellis
Enable trellis-based quantization (slower processing, but produces file
optimized for rate-distortion)
.TP
.B \-no_optim
Disable Huffman code optimization (faster processing, larger file)
.TP
.B \-adapt_bias
Disable the adaptive bias optimization.
.TP
.B \-no_metadata
Disable transfer of metadata from source to JPEG (saves file size, but discards
information).

.SH BUGS
Please report any bugs to the SJPEG discussion list:
https://groups.google.com/forum/#!forum/sjpeg
The issue tracker is located at:
https://github.com/webmproject/sjpeg/issues
.br
Patches welcome! See this page to get started:
http://www.webmproject.org/code/contribute/submitting-patches/

.SH EXAMPLES
sjpeg \-q 50 picture.png \-o picture.jpg
.br
sjpeg picture.jpg \-r 90 \-o optimized_jpeg.jpg

.SH AUTHORS
\fBsjpeg\fP was written by Pascal Massimino.
.br
The latest source tree is available at http://www.webmproject.org/code
.PP
This manual page was written by Pascal Massimino <pascal.massimino@gmail.com>,
for the Debian project (and may be used by others).

.SH SEE ALSO
.BR cjpeg (1), djpeg(1)
.br
.SS Input file format details
PPM: http://netpbm.sourceforge.net/doc/ppm.html
